# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_ExplanationConfig do
  @moduledoc """
  Message holding configuration options for explaining model predictions. There are three feature attribution methods supported for TensorFlow models: integrated gradients, sampled Shapley, and XRAI. [Learn more about feature attributions.](/ai-platform/prediction/docs/ai-explanations/overview)

  ## Attributes

  *   `integratedGradientsAttribution` (*type:* `GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_IntegratedGradientsAttribution.t`, *default:* `nil`) - Attributes credit by computing the Aumann-Shapley value taking advantage of the model's fully differentiable structure. Refer to this paper for more details: https://arxiv.org/abs/1703.01365
  *   `sampledShapleyAttribution` (*type:* `GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_SampledShapleyAttribution.t`, *default:* `nil`) - An attribution method that approximates Shapley values for features that contribute to the label being predicted. A sampling strategy is used to approximate the value rather than considering all subsets of features.
  *   `xraiAttribution` (*type:* `GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_XraiAttribution.t`, *default:* `nil`) - Attributes credit by computing the XRAI taking advantage of the model's fully differentiable structure. Refer to this paper for more details: https://arxiv.org/abs/1906.02825 Currently only implemented for models with natural image inputs.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :integratedGradientsAttribution =>
            GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_IntegratedGradientsAttribution.t()
            | nil,
          :sampledShapleyAttribution =>
            GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_SampledShapleyAttribution.t() | nil,
          :xraiAttribution =>
            GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_XraiAttribution.t() | nil
        }

  field(:integratedGradientsAttribution,
    as: GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_IntegratedGradientsAttribution
  )

  field(:sampledShapleyAttribution,
    as: GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_SampledShapleyAttribution
  )

  field(:xraiAttribution, as: GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_XraiAttribution)
end

defimpl Poison.Decoder, for: GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_ExplanationConfig do
  def decode(value, options) do
    GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_ExplanationConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_ExplanationConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
